/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.buzzwords.model;

import com.buzzwords.clientside.model.ClientRating;
import com.google.appengine.api.datastore.Key;
import java.util.Date;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

/**
 *
 * @author potlow
 */
@PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true")
public class Rating {

    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;

    @Persistent
    private String comment = "";
    
    @Persistent
    private Boolean like;
    
    @Persistent
    private Definition definition;

    @Persistent
    private String username = "";

    @Persistent
    private Date creationDate;

    public Rating(String comment, Boolean like, Definition definition, String username) {
        this.comment = comment;
        this.like = like;
        this.definition = definition;
        this.username = username;
    }

    public Rating() {
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Boolean isLike() {
        return like;
    }

    public void setLike(Boolean like) {
        this.like = like;
    }

    public Date getCreationDate() {
        return creationDate;
    }

    public void setCreationDate(Date creationDate) {
        this.creationDate = creationDate;
    }

    public Key getKey() {
        return key;
    }

    public void setKey(Key key) {
        this.key = key;
    }

    public Definition getDefinition() {
        return definition;
    }

    public void setDefinition(Definition definition) {
        this.definition = definition;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public ClientRating getClientRating() {
        ClientRating clientRating = new ClientRating();
        clientRating.setComment(comment);
        clientRating.setLike(like);
        clientRating.setUsername(username);

        return clientRating;
    }
}
